package com.zmm.merchant.model;

import com.zmm.common.valid.AddGroup;
import com.zmm.common.valid.ListValue;
import com.zmm.common.valid.UpdateGroup;
import com.zmm.common.valid.UpdateStatusGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import javax.validation.constraints.Pattern;

/**
 * 商家模型对象
 * @author 900045
 * @description:
 * @name Merchant
 * @date By 2021-07-06 11:17:55
 */
@Data
public class Merchant {


	@NotNull(message = "修改必须指定商家ID",groups ={UpdateGroup.class} )
	@Null(message = "新增时不能指定商家ID",groups = {AddGroup.class})
	private Integer merchantId;
	/**
	 * 商家名称
	 */
	@NotBlank(message = "商家名称不能为空",groups = {AddGroup.class,UpdateGroup.class})
	@Length(max = 20,message = "名称不能超过20个字符")
	@Pattern(regexp = "^[\\u4E00-\\u9FA5A-Za-z0-9\\*]*$",message = "名称最多20字符,包含文字、字母、数字")
	private String merchantName;
	/**
	 * 商家店铺名称
	 */
	@NotBlank(message = "商家店铺名称不能为空",groups = {AddGroup.class,UpdateGroup.class})
	private String merchantShopName;

	/**
	 * 商家账号
	 */
	@NotBlank(message = "商家账号不能为空",groups = {AddGroup.class,UpdateGroup.class})
	private String merchantAccount;

	/**
	 * 商家账号 -密码
	 */
	@NotBlank(message = "商家密码不能为空",groups = {AddGroup.class,UpdateGroup.class})
	private String merchantPassword;
	/**
	 * 商家行业
	 * @Pattern(regexp = "^[1][3,4,5,6,7,8,9][0-9]{9}$",message = "手机号格式有误")
	 * @Email(message = "邮箱格式不对")
	 * @Pattern(regexp = "^[a-zA-Z]$",message = "检索首字母必须是一个字母",groups = {AddGroup.class,UpdateGroup.class})
	 * @Future(message = "时间必须是将来时间")
	 */
	private String merchantScope;
	/**
	 * 1提交成功，2审核通过，3审核不通过
	 */
	@NotNull(groups = {AddGroup.class, UpdateStatusGroup.class})
	@ListValue(values={1,2,3},message = "请给指定范围的值1~3",groups = {AddGroup.class, UpdateStatusGroup.class})
	private Integer status;

	/**
	 * 上下架 1:下架 2:上架
	 */
	@NotNull(groups = {AddGroup.class, UpdateStatusGroup.class})
	@ListValue(values={1,2},message = "请给指定范围的值(1~2)",groups = {AddGroup.class, UpdateStatusGroup.class})
	private Integer soldOut;
	
	private Long createTime;
	
	private Long updateTime;
}
